<template>
  <div class="main-container-app">
    <el-row class="form-contain">
      <parking-mag-form @handleQueryParkingMag="handleQueryParkingMag"></parking-mag-form>
    </el-row>
    <div class="table-contain">
    <parking-mag-table :searchList="parkingMagRes" :listLoadingParkingMag="loading"
                       @handleCurrentChangeParkingMag="handleCurrentChangeParkingMag"
                       @handleSizeChangeParkingMag="handleSizeChangeParkingMag"></parking-mag-table>
    </div>
  </div>
</template>

<script>
  /* eslint-disable */
  import ParkingMagForm from "./parkingMagChild/parkingMagForm";
  import ParkingMagTable from "./parkingMagChild/parkingMagTable";
  import {fetchListParkMag} from "../../api/parkingResource/parkingMag";
  import {selDictonaryValue} from "../../api/dictionary";

  export default {
    components: {
      ParkingMagTable,
      ParkingMagForm
    },
    data() {
      return {
        parkingMagRes: null,
        loading: false,
        queryData:{
          park_date: '',
          park_eroad: '',
          park_jdbsc: '',
          park_name: '',
          park_no: '',
          park_road: '',
          park_roadkind: '',
          park_sroad: '',
          park_ssdw: '',
          park_status: '',
          park_sfbz: ''
        },
        listQuery: {
          page: 1,
          limit: 20
        }
      }
    },
    methods: {
      handleQueryParkingMag(val) {
        this.queryData = val
        this.listQuery.page=1
        this.listQuery.limit=20
        this.getDataListParkingMag()
      },
      handleSizeChangeParkingMag(val) {
        this.listQuery.limit = val
        this.listQuery.page = 1
        this.getDataListDouPay()
      },
      handleCurrentChangeParkingMag(val) {
        this.listQuery.page = val
        this.getDataListParkingMag()
      },
      getDataListParkingMag() {
        this.loading = true
        fetchListParkMag(this.listQuery,this.queryData).then(res=>{
          selDictonaryValue(res).then(response=>{
            this.parkingMagRes=response
            console.log(response)
            this.loading = false
          })

        })
      }
    }

  }
</script>

<style scoped>
  .parkingMag {
    padding: 32px;
    background-color: rgb(240, 242, 245);
  }
</style>
